import Vue from "vue";
import VueRouter from "vue-router";
import Login from "../components/Login.vue";
import Blogs from "../components/Blogs.vue";
import BlogDetail from "../components/BlogsDetail.vue";
import BlogEdit from "../components/BlogEdit.vue";
import Main from "../components/main.vue";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "login",
    component: Login,
  },
  {
    path: "/main",
    name: "main",
    component: Main,
    children: [
      {
        path: "/blogs",
        name: "blogs",
        component: Blogs,
      },
    ],
  },

  {
    path: "/blogDetail/:blogId",
    name: "blogDetail",
    component: BlogDetail,
  },
  {
    path: "/blogEdit/:blogId",
    name: "blogEdit",
    component: BlogEdit,
  },
];

const router = new VueRouter({
  routes,
  mode: "history",
});

export default router;
